package com.ld.collegetask;

import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.view.View;

import com.ld.collegetask.databinding.ActivityOrderMemberReleaseOcostListBinding;

import me.leefeng.promptlibrary.PromptDialog;

public class OrderMemberReleaseOcostListActivity extends BaseActivity {
    private String ocost;
    private String ocommission;
    private PromptDialog promptDialog;

    private ActivityOrderMemberReleaseOcostListBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_order_member_release_ocost_list);
        //设置标题
        setTitleView(this, binding.ilTitle, true, true, true,false);
        setLoadingView(this,binding.ilLoading);
        setTitle("跑腿费用");
        setText("确定");
        promptDialog = new PromptDialog(this);
        Intent intent = getIntent();
        ocost = intent.getStringExtra("ocost");
        ocommission = intent.getStringExtra("ocommission");
        if (ocost != null && !ocost.equals("0")) {
            binding.orderMemberReleaseMissionShuru.setText(ocost);
        }
        if (ocommission != null && !ocommission.equals("0")) {
            binding.orderMemberReleaseCommissionShuru.setText(ocommission);
        }

//        binding.orderMemberReleaseButton.setOnClickListener(this);
        binding.orderMemberReleaseMissionShuru.setRegion(9999.99f, 0.0f);
        binding.orderMemberReleaseMissionShuru.setTextWatcher();
        binding.orderMemberReleaseCommissionShuru.setRegion(9999.99f, 0.0f);
        binding.orderMemberReleaseCommissionShuru.setTextWatcher();
    }

    @Override
    public void loading() {

    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.tv_head_text:
                if (!binding.orderMemberReleaseMissionShuru.getText().toString().equals("")) {
                    ocost = binding.orderMemberReleaseMissionShuru.getText().toString();
                } else {
                    ocost = "0";
                }
                if (!binding.orderMemberReleaseCommissionShuru.getText().toString().equals("")) {
                    ocommission = binding.orderMemberReleaseCommissionShuru.getText().toString();
                } else {
                    ocommission = "0";
                }
                Intent it = new Intent(this, OrderMemberInfoActivity.class);
                it.putExtra("ocost", ocost);
                it.putExtra("ocommission", ocommission);
                setResult(1, it);
                finish();
                break;
        }
    }
}